package com.uidp.search;

import static com.uidp.hibernatelayer.ModulModulElementsDAO.MODUL;
import static org.hibernate.criterion.Restrictions.idEq;
import com.acsior.sbc.exception.BusinessException;
import com.acsior.sbc.exception.SearchException;
import com.acsior.sbc.impl.hibernate.SearchHibernateBusinessObject;
import com.uidp.domain.Modul;
import com.uidp.domain.ModulElements;
import com.uidp.domain.ModulModulElements;
import com.uidp.hibernatelayer.ModulModulElementsDAO;
import com.uidp.hibernatelayer.ModulModulElementsVO;

public class ModulModulElemntSearch
		extends
		SearchHibernateBusinessObject<ModulModulElementsVO, ModulModulElementsDAO, ModulModulElements> {

	private ModulModulElements modulelcriteria;

	public ModulModulElemntSearch() throws BusinessException {
		super();
	}

	/** @see SearchHibernateBusinessObject#buildCriteria() */
	@Override
	protected void buildCriteria() throws SearchException {
		super.buildCriteria();
		if (getModul() != null && getModul().isEditMode()) {
			getCriteria().createCriteria(MODUL).add(idEq(getModul().getId()));
		}
	}

	/** @see SearchObject#initialize() */
	@Override
	protected final void initialize() throws BusinessException {
		super.initialize();

		this.modulelcriteria = new ModulModulElements();
	}

	@Override
	protected ModulModulElements createResultObject(ModulModulElementsVO d)
			throws BusinessException {
		return new ModulModulElements(d);
	}

	@Override
	protected Class<ModulModulElementsDAO> getDAOClass() {
		return ModulModulElementsDAO.class;
	}

	public ModulModulElements getModulelcriteria() {
		return modulelcriteria;
	}

	public void setModulelcriteria(ModulModulElements modulelcriteria) {
		this.modulelcriteria = modulelcriteria;
	}

	public Modul getModul() {
		return getModulelcriteria().getModul();
	}

	public void setModul(Modul modul) {
		getModulelcriteria().setModul(modul);
	}

	public ModulElements getModulElements() {
		return getModulelcriteria().getModulElements();

	}

	public void setModulElements(ModulElements modulElements) {
		getModulelcriteria().setModulElements(modulElements);
	}

}
